#include <QApplication>
#include <QMessageBox>

#include "MainDialog.h"
#include "Config/Config.h"

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    QCoreApplication::setApplicationName("Signatures Detector");

    Config config;
    std::string error;

    config.loadFromFile("test.json", error);
    if (!error.empty())
    {
        QMessageBox message;

        message.setIcon(QMessageBox::Warning);
        message.setWindowTitle("Signatures Detector");
        message.setText(QString("Configuration file test.json load error") + error.c_str());

        message.addButton("&Ok", QMessageBox::AcceptRole);

        message.exec();
        return a.exec();
    }

    MainDialog w(NULL, &config);
    w.show();

    return a.exec();
}
